package com.com.designpatterns.composite;

import java.util.Collections;
import java.util.Enumeration;
import java.util.NoSuchElementException;

/**
 * Created by User on 17/09/2014.
 */
public class Employee extends AbstractEmployee {

    public Employee(String _name, float _salary){
        name = _name;
        salary = _salary;
        leaf = true;
    }

    public Employee(Employee _parent, String _name, float _salary) {
        name = _name;
        salary = _salary;
        parent = _parent;
        leaf = true;
    }


    @Override
    public float getSalary() {
        return salary;
    }

    @Override
    public String getName() {
        return name;
    }

    @Override
    public boolean addEmployee(Employee e) throws NoSuchElementException {
        throw new NoSuchElementException("No subordinates for employees who are not managers!");
    }

    @Override
    public boolean remove(Employee e) throws NoSuchElementException {
        throw new NoSuchElementException("No subordinates for employees who are not managers!");
    }

    @Override
    public Enumeration subordinates() {
        return Collections.emptyEnumeration();
    }

    @Override
    public Employee getChild(String s) {
        return null;
    }

    @Override
    public double getSalaries() {
        return 0;
    }
}
